<?php namespace Admin\Controller;

use Hdphp\Controller\Controller;

use Common\Model\User;


class LoginController extends Controller{
	private $data;
	
	public function __init(){
		$this->data=new User;

	}
	
	public function login(){
		if(IS_POST){
		$result=$this->data->login();
		if(!$result){
			View::error($this->data->getError());
		}else{
			go(U('Index/index'));
		}
			
		}
		View::make();
	}
	
	public function out(){
//		清除session
		session_unset();
		session_destroy();
		go(U('Index/index'));
	}
	
}

